package cn.bonoon.controllers.account;

import cn.bonoon.kernel.annotations.Transform;
import cn.bonoon.kernel.support.models.ObjectEditor;
import cn.bonoon.kernel.web.annotations.components.AsCheckbox;
import cn.bonoon.kernel.web.annotations.components.AsDateBox;
import cn.bonoon.kernel.web.annotations.components.AsSelector;
import cn.bonoon.kernel.web.annotations.components.AsTextArea;
import cn.bonoon.kernel.web.annotations.form.FormEditor;
import cn.bonoon.kernel.web.annotations.form.PropertyEditor;
import cn.bonoon.kernel.web.annotations.form.PropertyHelper;

/**
 * <pre>
 * 专门用来对账号进行编辑的.
 * 编辑的内容包括:
 * 1.密码的安全设置
 * 2.密码过期设置
 * 3.角色管理
 * 4.用户组管理
 * 5.状态设定
 * 
 * <font color='red'>
 * 注意：用户的身份一般是不允许修改的,即注册或添加时是什么样的身份,就会一直使用这样的身份.
 *     身份一般对操作系统的功能是没有影响的,除了一些特殊的限制之外.
 * </font>
 * </pre>
 * 
 * @author jackson
 * 
 */
@Transform
@FormEditor(2)
public abstract class AccountEditor extends ObjectEditor implements AccountDefine {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2646173106636957945L;
	@PropertyEditor(value = 1, required = true)
	private String name;

	@PropertyEditor(value = 100, colspan = 1)
	@AsTextArea
	private String remark;

	@PropertyEditor(value = 4)
	@AsSelector
	private Integer status;
	
	@PropertyEditor(value = 5)
	@AsSelector
	private Integer flag;

	@PropertyEditor(8)
	@PropertyHelper("如果被强制修改密码，则用户在下次登录的时候会被要求修改密码，如果不修改密码，则无法正常登录系统")
	@AsCheckbox("是")
	private boolean forcedChangePwd;
	
	@PropertyEditor(9)
	@AsDateBox
	private String expiredAt;

	// @PropertyEditor(name = "角色", value = 6, colspan = 1)
	// @AsComboBox
	// @AutoDataLoader(RoleEntity.class)
	// private Long[] roles;

	// @TransformField(readable = false, writable = WriteModel.NONE)
	// @PropertyEditor(name = "用户组", value = 7, colspan = 1)
	// @AsComboBox("/s/account/groups")
	// private Long[] groupIds;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getFlag() {
		return flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}

	public boolean isForcedChangePwd() {
		return forcedChangePwd;
	}

	public void setForcedChangePwd(boolean forcedChangePwd) {
		this.forcedChangePwd = forcedChangePwd;
	}

	public String getExpiredAt() {
		return expiredAt;
	}

	public void setExpiredAt(String expiredAt) {
		this.expiredAt = expiredAt;
	}

	// public Long[] getRoles() {
	// return roles;
	// }
	//
	// public void setRoles(Long[] roles) {
	// this.roles = roles;
	// }
}
